﻿using System;
using System.Web.Security;
using MonkeyWarranty.Web.Common;

namespace MonkeyWarranty.Web
{
    public partial class SiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!bool.Parse(Application["License"].ToString()))
                Server.Transfer("~/InvalidLicense.html");
            if (WarrantyCommon.CurrrentEmployee != null)
            {
                if (!WarrantyCommon.CurrrentEmployee.IsAdmin)
                {
                    Server.Transfer("~/NoPermission.html");
                }
            }
        }

        protected void OnLoggingOut(object sender, EventArgs e)
        {
            WarrantyCommon.CurrrentEmployee = null;
            Session.Clear();
            Session.Abandon();
            FormsAuthentication.SignOut();
        }
    }
}
